<%def name="render_article_list(articles, preview=100)">
<table>
  <thead>
    <tr>
    % for header in ["", "title", "body", "date", "author", "published"]:
      <th>${_(header).capitalize()}</th>
    % endfor
    </tr>
  </thead>
  <tbody>
  % if articles:
    % for article in articles:
    <tr>
      <td>
        <ul>
          <li><a href="${url('edit_article', id=article.id)}">edit</a></li>
          <li><a href="#delete">delete</a></li>
        </ul>
      </td>
      <td>${article.title}</td>
    % if len(article.body) > preview:
      <td>${article.body[:preview]}...</td>
    % else:
      <td>${article.body}</td>
    % endif
      <td class="creationDate">${article.creation_date.strftime("%H:%M %d/%m/%Y")}</td>
      <td class="author">${article.author.name}</td>
      <td><em>${article.is_published}<em></td>
    </tr>
    % endfor
  % else:
    <tr><td colspan="6"><em>${_("no article").capitalize()}</em></td></tr>
  % endif
  </tbody>
</table>
</%def>
